<script>
init({
  title: 'Select/Prev/Next Page',
  desc: 'Go to the a specified/previous/next page:<br>`$table.bootstrapTable(\'selectPage\', 1)`<br>`$table.bootstrapTable(\'prevPage\')`<br>`$table.bootstrapTable(\'nextPage\')`.',
  links: ['bootstrap-table.min.css'],
  scripts: ['bootstrap-table.min.js']
})
</script>

<template>
  <div
    id="toolbar"
    class="form-inline"
  >
    <input
      id="page"
      class="form-control"
      style="width: 60px"
      type="number"
      value="2"
      min="1"
      max="3"
    >
    <button
      id="button"
      class="btn btn-secondary"
    >
      selectPage
    </button>
    <button
      id="button2"
      class="btn btn-secondary"
    >
      prevPage
    </button>
    <button
      id="button3"
      class="btn btn-secondary"
    >
      nextPage
    </button>
  </div>
  <table
    id="table"
    data-toggle="table"
    data-toolbar="#toolbar"
    data-height="420"
    data-pagination="true"
    data-url="json/data1.json"
  >
    <thead>
      <tr>
        <th data-field="id">
          ID
        </th>
        <th data-field="name">
          Item Name
        </th>
        <th data-field="price">
          Item Price
        </th>
      </tr>
    </thead>
  </table>
</template>

<script>
  const $table = $('#table')
  const $page = $('#page')
  const $button = $('#button')
  const $button2 = $('#button2')
  const $button3 = $('#button3')

  function mounted () {
    $button.click(function () {
      $table.bootstrapTable('selectPage', +$page.val())
    })
    $button2.click(function () {
      $table.bootstrapTable('prevPage')
    })
    $button3.click(function () {
      $table.bootstrapTable('nextPage')
    })
  }
</script>
